package com.kgcx.coupon.domain;

import com.kgcx.common.annotation.dict.Dict;
import com.kgcx.dbutils.annotation.SelectLike;
import com.kgcx.dbutils.annotation.SelectOneOfThem;
import com.kgcx.dbutils.domain.BaseDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import tk.mybatis.mapper.annotation.ColumnType;

import javax.persistence.Table;
import javax.persistence.Transient;
import java.sql.Timestamp;

@Table(name = "t_coupon_type")
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel("优惠券类型")
public class CouponType extends BaseDomain {

    public static final String CODE_TYPE_BY_TIME = "1";
    public static final String CODE_TYPE_BY_ORDER = "2";
    public static final String VALIDITY_TYPE_PERIOD = "1";
    public static final String VALIDITY_TYPE_DAYS = "2";

    @ApiModelProperty(value = "编号抬头", example = "13243", required = true)
    @SelectLike
    private String numbered;

    @ApiModelProperty(value = "编号生成方式,字典：couponValidityType", example = "1", required = true)
    private String codeType;

    @ApiModelProperty(value = "起始数字", example = "1", required = false)
    private Integer startNum;

    @ApiModelProperty(value = "累加幅度", example = "1", required = false)
    private Integer cumulativeNum;

    @ApiModelProperty(value = "代金券面额", example = "12", required = true)
    private Long money;

    @ApiModelProperty(value = "优惠券名称", example = "接机", required = true)
    @SelectLike
    private String couponName;

    @ApiModelProperty(value = "最低结算金额", example = "12", required = true)
    @ColumnType(column = "`trigger`")
    private Long trigger;

    @ApiModelProperty(value = "是否支持折后使用", example = "1", required = true)
    private Integer discountFlag;

    @ApiModelProperty(value = "领取有效期始", example = "1513973105000")
    private Timestamp validityStartTime;

    @ApiModelProperty(value = "领取有效期止", example = "1513973105000")
    private Timestamp validityEndTime;

    @ApiModelProperty(value = "使用有效期类型,字典：couponValidityType", example = "1", required = true)
    private String useValidityType;

    @ApiModelProperty(value = "使用期限时间起", example = "1513973105000")
    private Timestamp useStartTime;

    @ApiModelProperty(value = "使用期限时间止", example = "1513973105000")
    private Timestamp useEndTime;

    @ApiModelProperty(value = "失效时间设置（天数）", example = "10")
    private Integer invalidDate;

    @ApiModelProperty(value = "业务类型，字典：orderType", example = "1", required = true)
    @SelectOneOfThem(passWord = "0")
    private String orderType;


    @ApiModelProperty(value = "用车类型，字典：vehiclePurpose", example = "1", required = true)
    @SelectOneOfThem(passWord = "0")
    private String vehiclePurpose;


    @ApiModelProperty(value = "报价类型，字典：fareType", example = "1", required = true)
    @SelectOneOfThem(passWord = "0")
    private String fareType;


    @ApiModelProperty(value = "使用渠道，字典：orderChannel", example = "1", required = true)
    @SelectOneOfThem(passWord = "0")
    private String orderChannel;


    @ApiModelProperty(value = "使用者，字典：userType", example = "1", required = true)
    @SelectOneOfThem(passWord = "0")
    private String userType;


    @ApiModelProperty(value = "可用城市", example = "1", required = true)
    @SelectOneOfThem(passWord = "0")
    private String availableCity;


    @ApiModelProperty(value = "备注", example = "你好", required = false)
    private String remark;
    @ApiModelProperty(value = "优惠服务类型1-立即接机，2-立即接站，3-预约接机，4-预约接站，5-预约送机，6-预约送站，7-预约用车  8-立即用车", readOnly = true, example = "立即用车")
    @Dict(type = "orderType", fieldName = "orderType")
    @Transient
    private String orderTypeValue;

    @ApiModelProperty(value = "用车类型  公务轿车1  商务七座2  豪华轿车3", readOnly = true, example = "公务轿车")
    @Dict(type = "vehiclePurpose", fieldName = "vehiclePurpose")
    @Transient
    private String vehiclePurposeValue;

    @ApiModelProperty(value = "使用渠道：1-小程序，2-管理后台，3-iOS，4-安卓", readOnly = true, example = "app")
    @Dict(type = "orderChannel", fieldName = "orderChannel")
    @Transient
    private String orderChannelValue;

    @ApiModelProperty(value = "运价类型 1：常规价 2：套餐价 3：一口价", readOnly = true, example = "常规价")
    @Dict(type = "fareType", fieldName = "fareType")
    @Transient
    private String fareTypeValue;

    @ApiModelProperty(value = "使用者：1=本人使用，2=替他人叫车使用", readOnly = true, example = "本人使用")
    @Dict(type = "useType", fieldName = "useType")
    @Transient
    private String useTypeValue;

    @ApiModelProperty(value = "编号生成方式,字典：couponValidityType", example = "按生成时间", readOnly = true)
    @Dict(type = "couponCodeGenerateType", fieldName = "codeType")
    @Transient
    private String codeTypeValue;

    @ApiModelProperty(value = "使用有效期类型,字典：couponValidityType", example = "固定时间", readOnly = true)
    @Dict(type = "couponValidityType", fieldName = "useValidityType")
    @Transient
    private String useValidityTypeValue;
}
